def math2013(limit, d, loop):
    s = limit
    j = 0
    for i in range(0, loop):
        j = s % d
        s = j*10000 + limit
    print j
    print 'done'

if __name__ == "__main__":
    math2013(2003, 7, 2003)
